package com.bootdo.appsystem.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.bootdo.appsystem.dao.UserdetailsDao;
import com.bootdo.appsystem.domain.UserdetailsDO;
import com.bootdo.appsystem.service.UserdetailsService;



@Service
public class UserdetailsServiceImpl implements UserdetailsService {
	@Autowired
	private UserdetailsDao userdetailsDao;
	
	@Override
	public UserdetailsDO get(Integer id){
		return userdetailsDao.get(id);
	}
	
	@Override
	public List<UserdetailsDO> list(Map<String, Object> map){
		return userdetailsDao.list(map);
	}
	
	@Override
	public int count(Map<String, Object> map){
		return userdetailsDao.count(map);
	}
	
	@Override
	public int save(UserdetailsDO userdetails){
		return userdetailsDao.save(userdetails);
	}
	
	@Override
	public int update(UserdetailsDO userdetails){
		return userdetailsDao.update(userdetails);
	}
	
	@Override
	public int remove(Integer id){
		return userdetailsDao.remove(id);
	}
	
	@Override
	public int batchRemove(Integer[] ids){
		return userdetailsDao.batchRemove(ids);
	}

	@Override
	public UserdetailsDO getByUid(Integer uid) {
		HashMap<String , Object> map = new HashMap<>();
		map.put("uid",uid);
		List<UserdetailsDO> list = this.list(map);
		if(list.size() < 1){
			return null;
		}
		return list.get(0);
	}

}
